#ifndef _flash_h_
#define _flash_h_

/*
    固件区域大小
*/
#define FIRMWART_SIZE (1024 * 512)
/*
    flash页大小
*/
#define FLASH_PAGE_SIZE (1024 * 4)

/*
    固件数据操作
*/
esp_err_t flash_firmwart_erase(size_t dst_offset);
esp_err_t flash_firmwart_write(size_t dst_offset, const void *src, size_t size);
esp_err_t flash_firmwart_read(size_t dst_offset, void *dst, size_t size);

/*
    固件信息操作
*/
esp_err_t flash_firmwart_info_erase(void);
esp_err_t flash_firmwart_info_write(size_t dst_offset, const void *src, size_t size);
esp_err_t flash_firmwart_info_read(size_t dst_offset, void *dst, size_t size);
/*
    校验固件
*/
esp_err_t flash_chack_sum(uint8_t *sum);
/*
    烧录次数限制
*/
esp_err_t burn_nvs_init(void);
esp_err_t set_number_limit(uint32_t limit);
esp_err_t get_number_limit(uint32_t *limit);

#endif
